/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package common.web;

import common.model.WebUser;
import common.util.EbUtil;

/**
 *
 * @author shousuke
 */
public class UserController extends GenericSessionController {

    private WebUser user = null;

    public WebUser getUser() {
        if (user == null) {
            user = EbUtil.getUserFromSession();
        }
        return user;
    }

    public String edit() {
        merge(user, "User");
        return "home";
    }

    public String destroy() {
        return null;
    }

    public String getUsername() {
        if (user == null) {
            return "Guest";
        } else {
            String un = user.getUsername();
            return (un == null) ? "Guest" : un;
        }
    }
}
